package com.example.sy.mapper;

import com.example.sy.pojo.user;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface userMapper {
    @Select("SELECT * FROM userlist")
    public List<user> findAll();


    //搜索  前边加#号
    @Select("select * from userlist where username = #{username}")
    public  List<user> findUser(String username);

    //新增
    @Insert("insert into userlist (username,password) values(#{username},#{password})")
    int addUser(user user);

    //删除
    @Delete("delete from userlist where username=#{username}")
    int deleteUser(user user);


    //登录
    @Select("select * from userlist where username=#{username} and password=#{password}")
    public List<user> userLogin(user user);
}
